//
//  MGTreeViewController.h
//  MGSplitView
//
//  Created by Matt Gemmell on 26/07/2010.
//  Copyright Instinctive Code 2010.
//

#import <UIKit/UIKit.h>
#import "AppDelegate.h"
#import "MGChartViewController.h"
#import "AlertPrompt.h"
#import "treeNode.h"
#import "tree_ViewCell.h"
#import "Data_Model.h"
#import "SourceListItem.h"
#import "Data_Object.h"
#import "MGQuoteViewController.h"
#import "tree_DatasourceManager.h"

@interface MGTreeViewController :UIViewController<UITableViewDataSource,UITableViewDelegate,tree_DatasourceManagerDelegate,UIPopoverControllerDelegate  > {
   
    MGChartViewController *chartViewController;
    MGQuoteViewController *quoteViewController;
    
    AppDelegate *delgete_AppDelegate;
    
    tree_DatasourceManager *datasourceManager;
    NSMutableArray *sortDescriptors;
    
    NSMutableArray *cods_array;
    
    //資料物件
    Data_Model *datamodel_chart;  
    
    UIToolbar       *toolbar_tree;  
    
    UIBarButtonItem *Item_add_folderORwatchlist;      //群組與投資組合增加鈕 
    UIBarButtonItem *Item_rename_folderORwatchlist;   //群組與投資組合更名  
    UIBarButtonItem *Item_edit_folderORwatchlist;     //群組與投資組合編輯 
    UIBarButtonItem *Item_copy_folderORwatchlist;     //群組與投資組合複製  
    UIBarButtonItem *Item_sort_folderORwatchlist;     //群組與投資組合複製      
    
    UIBarButtonItem *Item_fix;    
    
    UIPopoverController *fileCreatorPopoverController;
    
    UIAlertView *createwatchlistAlert_level_same;
    UIAlertView *createwatchlistAlert_level_sub;
	UIAlertView *createDirectoryAlert_level_same;
    UIAlertView *createDirectoryAlert_level_sub;
	UIAlertView *duplicateFileAlert;    
    //修改名稱
    AlertPrompt *rename_prompt;    
    
    UITableView *treetable;
    
    int index_chart;
    
  
}
@property (nonatomic, retain) MGQuoteViewController *quoteViewController;
@property (nonatomic, retain) MGChartViewController *chartViewController;
@property (nonatomic, retain) AppDelegate *delgete_AppDelegate;
@property (nonatomic, retain) tree_DatasourceManager *datasourceManager;
@property (nonatomic, retain) NSMutableArray *sortDescriptors;
@property (nonatomic, retain) Data_Model *datamodel_chart;
@property (nonatomic, retain) NSMutableArray *cods_array;
-(void)selectFirstRow;
-(void)tableview_reload:(NSMutableArray *)cods_a;
- (NSString *)applicationDocumentsDirectory;
//更新報價
-(void)start_quote_table_refresh;
-(void)drawnext_index;//畫下一個

//底層框架改變
-(void)view_frame_size_change:(CGRect)newframe; 

//樹狀節點增加
- (void)toggle_tree_add_folderORwatchlist:(id)sender;

@end
